﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ForkCarRelationManager.db;
using System.Data;
namespace ForkCarRelationManager.Utility
{
    class Util
    {
        dbOperate dbo = new dbOperate();
        /*
         * 判断是否为数字
         * */
        public bool isnumeric(string str)
        {
            char[] ch = new char[str.Length];
            ch = str.ToCharArray();
            for (int i = 0; i < ch.Length; i++)
            {
                if (ch[i] < 48 || ch[i] > 57)
                {
                    return false;
                }
            }
            return true;
        }
        /*
         * 权限判断
         * */
        public int  Ifpower(string admin)
        {
            int ifpower = 0;
            string sql="select Ifpower from Admin where UserName='"+admin+"'";
            DataTable adminTable = dbo.GetDate(sql);
            if (adminTable.Rows.Count != 0)
            {
                ifpower = Convert.ToInt32( adminTable.Rows[0][0].ToString());
            }
            return ifpower;
        }
    }
}
